<extend name="Home@Base/common" />
<block name="body">
  <div class="span9 page_message">
    <section id="contents">
    <include file="Home@Addons/_nav" /> 
      <div class="tab-content">
      	<div style="float:left; width:500px">
        <form method="post" class="form-horizontal" action="{:U('config')}">
          <div class="form-item cf">
            <label class="item-label"> 封面标题:  </label>
            <div class="controls">
              <input type="text" value="{$data['title']}" class="text input-large" name="config[title]">
            </div>
          </div>
          <div class="form-item cf">
            <label class="item-label"> 封面图片: <span class="check-tips">最佳尺寸为900*500</span> </label>           
            <div class="controls uploadrow2" title="点击修改图片" rel="cover">
                                  <input type="file" id="upload_picture_cover">
                                  <input type="hidden" name="config[cover]" id="cover_id_cover" value="{$data['cover']}"/>
                                  <div class="upload-img-box">
                                    <notempty name="data['cover']">
                                   
                                      <div class="upload-pre-item2"><img width="100" height="100" src="{$data['cover']|get_cover_url}"/></div>
                                      <em class="edit_img_icon">&nbsp;</em>
                                    </notempty>
                                    
                                  </div>
                              </div>
          </div>
          <div class="form-item cf">
            <label class="item-label"> 封面简介:  </label>
            <div class="controls">
              <label class="textarea input-large">
                <textarea name="config[info]">{$data['info']}</textarea>
              </label>
            </div>
          </div>
          </div>
          <!--通用的微信预览模板-->
            <!--头部标题栏-->
            <!--鉴于样式title放进具体每块模块-->
            <!--CSS模块-->
            <div class="weixin-preview">
                <p class="preview-tips">微信里回复“微官网”的回复效果</p>
                <div class="weixin-box">
                <p class="weixin-title"></p>
                <div class="weixin-cover"><img class="weixin-cover-pic" src=""/></div>
                <p class="weixin-content">
                    
                </p>
            </div>
            </div>
 		  <div class="form-item form_bh" style="text-align:center">
         	 <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
          </div>
        </form>
      </div>
    </section>
  </div>
<script type="text/javascript">
$('.tab-content').addClass('has-weixinpreivew');
if($('input[name="title"]').val()!=undefined){
	$('.weixin-title').html($('input[name="title"]').val());
}else{
	$('.weixin-title').html($('input[name="config[title]"]').val());
}
if($('textarea[name="content"]').val()!=undefined){
	$('.weixin-content').html($('textarea[name="content"]').val());
}else if($('textarea[name="intro"]').val()!=undefined){
	$('.weixin-content').html($('textarea[name="config[intro]"]').val());
	}else{
	$('.weixin-content').html($('textarea[name="config[info]"]').val());	
}
var weixin_cover_picurl = $('#cover_id_picurl').next().find('img').attr('src');
if(weixin_cover_picurl==undefined)weixin_cover_picurl=$('#cover_id_cover').next().find('img').attr('src');
if($('#cover_id_cover').val()==undefined && $('#cover_id_picurl').val()==undefined){
	$('.weixin-preview').hide();
	}
if(weixin_cover_picurl==undefined || weixin_cover_picurl==""){
	$('.weixin-cover-pic').attr('src',"__IMG__/no_cover.png");
}else{
	$('.weixin-cover-pic').attr('src',weixin_cover_picurl);
}


$('input[name="config[title]"]').keyup(function(){
	$('.weixin-title').html($(this).val());
	});
$('input[name="title"]').keyup(function(){
	$('.weixin-title').html($(this).val());
	});	
$('textarea[name="content"]').keyup(function(){
	$('.weixin-content').html($(this).val());
	});
$('textarea[name="info"]').keyup(function(){
	$('.weixin-content').html($(this).val());
	});
$('textarea[name="config[info]"]').keyup(function(){
	$('.weixin-content').html($(this).val());
	});	
$('textarea[name="des_jj"]').keyup(function(){
	$('.weixin-content').html($(this).val());
	});
$('textarea[name="intro"]').keyup(function(){
	$('.weixin-content').html($(this).val());
	});	
</script>  
</block>
<block name="script"> 
  <script type="text/javascript" charset="utf-8">
	$(function(){
		//初始化上传图片插件
		initUploadImg();
		initUploadFile();
		//支持tab
		showTab();
	})
</script> 
</block>
